import{synchronization}from'../mz/mz.js'
import { __PATH } from '../mz/mz.js';
import {
    Read_player,
    existplayer,
    Write_player,
    Write_thing,
    getplayerdang
  } from '../mz/mz.js';
  import fs from 'fs';
export class tongbu extends plugin {
    constructor() {
      super({
        name: 'Yunzai_Bot_tongbu',
        dsc: '网站模块',
        event: 'message',
        priority: 600,
        rule: [
          {
            reg: /^(#|\/)名字同步.*/,
            fnc: 'tongbu',
          },
        //   {
        //     reg: /^(#|\/)创建存档.*/,
        //     fnc: 'tongbu2',
        //   }
        ],
      });
    }
    async tongbu(e){
      await synchronization(e)
      return;
    }
    // async tongbu2(e){
    //     if (!e.isGroup) {
    //         return;
    //       }
          
    //       let usr_qq = e.user_id;
    //       let ifexistplay = await existplayer(usr_qq);
          
    //       if (ifexistplay) {
    //         e.reply("已有存档");
    //         return;
    //       }
          
    //       let File_msg = fs.readdirSync(__PATH.player_path);
    //       let n = File_msg.length + 1;
          
    //       let new_player = {
    //         id: e.user_id,
    //         sex: 0, 
    //         名号: `路人甲${n}号`,
    //         宣言: '这个人很懒还没有写',
    //         称号: `无`,
    //         积分: 0,
    //         坤坤长度: 0,
    //         lastTriggerDate: "无"
    //       };
          
    //       await Write_player(usr_qq, new_player);
          
    //       let new_thing = {
    //         道具: [],
    //       };
          
    //       await Write_thing(usr_qq, new_thing);
          
    //       e.reply("创建存档成功");
    //       return;
    //     }
    
    
    }





